import request from '@/utils/request'

export function login(data) {
  return request({
    url: 'api/back/admin_users/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

// export function logout() {
//   return request({
//     url: '/user/logout',
//     method: 'post'
//   })
// }

export function addAccount(params) {
  return request({
    url: '/api/back/users',
    method: 'post',
    params
  })
}
export function createAdmin(params) {
  return request({
    url: '/api/back/admin_users',
    method: 'post',
    params
  })
}
export function getAdmin(params) {
  return request({
    url: '/api/back/admin_users',
    method: 'get',
    params
  })
}
export function forbbidenAdmin(params) {
  return request({
    url: '/api/back/admin_users/switch',
    method: 'post',
    params
  })
}
export function searchAdmin(params) {
  return request({
    url: '/api/back/admin_users',
    method: 'get',
    params
  })
}
export function editUser(params) {
  return request({
    url: '/api/back/admin_users',
    method: 'post',
    params
  })
}
export function editAuthority(num, name) {
  return request({
    url: '/api/back/admin_users/' + num,
    method: 'post',
    params: name
  })
}
export function editAdmin(params, id) {
  return request({
    url: '/api/back/users/' + id,
    method: 'post',
    params
  })
}
export function forbidden(params) {
  return request({
    url: '/api/back/users/switch',
    method: 'post',
    params
  })
}
